<? 
/**
 * Mailer.php
 *
 * The Mailer class is meant to simplify the task of sending
 * emails to users. Note: this email system will not work
 * if your server is not setup to send mail.
 *
 * If you are running Windows and want a mail server, check
 * out this website to see a list of freeware programs:
 * <http://www.snapfiles.com/freeware/server/fwmailserver.html>
 */
 
class Mailer
{
	/**
	* sendWelcome - Sends a welcome message to the newly
	* registered user, also supplying the username and
	* password.
	*/
	function sendWelcome($user, $email, $pass, $randID)
	{
		$from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
		$subject = "[RBE-POD] Resources and Projects - Welcome!";
		$body = $user.",\n\n"
		."Welcome! You've just registered at RBE-POD.NET\n\n"
		."Please click here to verify your account: http://www.rbe-pod.net/confirm.php?user=$user&id=$randID \n\n"
		."Your account was created with the following information:\n\n"
		."Username: ".$user."\n"
		."Password: ".$pass."\n\n"
		."If you ever lose or forget your password, a new "
		."password will be generated for you and sent to this "
		."email address, if you would like to change your "
		."email address you can do so by going to the "
		."My Account page after signing in.\n\n"
		."- RBE-POD Team";
		
		return mail($email,$subject,$body,$from);
	}
	
	/**
	* sendNewPass - Sends the newly generated password
	* to the user's email address that was specified at
	* sign-up.
	*/
	function sendNewPass($user, $email, $pass)
	{
		$from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
		$subject = "ZeitgeistResources.com - Your new password";
		$body = $user.",\n\n"
		."We've generated a new password for you at your "
		."request, you can use this new password with your "
		."username to log in to www.rbe-pod.net\n\n"
		."Username: ".$user."\n"
		."New Password: ".$pass."\n\n"
		."It is recommended that you change your password "
		."to something that is easier to remember, which "
		."can be done by going to the My Account page "
		."after signing in.\n\n"
		."- RBE-POD Team";
		
		return mail($email,$subject,$body,$from);
	}
	
	function sendApplication($email, $user, $projectName, $message)
	{
		$from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
		$subject = $projectName." Application";
		$body = "You have just received an application from ".$user." on www.rbe-pod.net\n\n"
		."http://www.rbe-pod.net/profile.php?user=".$user."\n\n"
		.$message."\n\n"
		."- Zeitgeist Resources Team";
		
		return mail($email,$subject,$body,$from);
	}
	
	function sendMessageNotify($email, $to, $fro)
	{
		$from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">";
		$subject = "Message Notification";
		$body = "$to"."!\nYou have just received a message from ".$fro." on www.rbe-pod.net\n\n"
		."Click http://www.rbe-pod.net/messages.php to view your messages.\n\n"
		."- RBE-POD Team";
		
		return mail($email,$subject,$body,$from);
	}
};

/* Initialize mailer object */
$mailer = new Mailer;
?>
